<?php
namespace app\common\model;

use think\Model;

class Region extends Model
{

    public function selectRegion(array $where=[])
    {
        return $this->where($where)->order('sort asc')->select();
    }
    public function countRegion(array $where=[])
    {
        return $this->where($where)->count();
    }
    public function valueRegion(array $where, $field)
    {
        return $this->where($where)->value($field);
    }

    public function findRegion(array $where, $fields=false) {
        return $this->where($where)->field($fields)->find();
    }

    public function updateRegion(array $data, array $where)
    {
        return $this->where($where)->update($data);
    }

    public function deleteRegion(array $where)
    {
        return $this->where($where)->update(['isDelete'=>1]);
    }

    public function addRegion(array $data)
    {
        return $this->insert($data);
    }
}